package org.cvcsc.weproject.repository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class TestUtils {
    @Autowired
    private AttendanceRepository attendanceRepository;
    @Autowired
    private StudentRepository studentRepository;
    @Autowired
    private ClazzRepository clazzRepository;

    @Autowired
    private CourseScheduleRepository courseScheduleRepository;

    /**
     *
     * 给测试清空数据库用
     * 删除数据库所有数据
     * 针对所有的 domain 定义，需要分析依次调用各个xxxrepository.deleteAllInBatch的顺序
     *
     */
    public void clearAll() {
        this.attendanceRepository.deleteAllInBatch();
        this.courseScheduleRepository.deleteAllInBatch();
        this.clazzRepository.deleteAllInBatch();
        this.studentRepository.deleteAllInBatch();
    }
}
